// my-fresh-blog/routes/admin/logout.tsx
import { Handlers } from "$fresh/server.ts";
import { deleteAdminSessionCookie } from "../../utils/auth.ts";

export const handler: Handlers = {
  GET(req, _ctx) {
    const headers = new Headers();
    const url = new URL(req.url);
    const redirectUrl = url.searchParams.get("redirect") || "/";
    deleteAdminSessionCookie(headers);
    headers.set("location", redirectUrl);
    return new Response(null, { status: 303, headers });
  },
};
export default function LogoutPage() { return null; }